#include "dashboard.h"

namespace robot {
Dashboard::Dashboard(Serialport &serial_port) :
		m_serial_port(&serial_port) {
}

Dashboard::~Dashboard() {
}

void Dashboard::execute(ICommand *command) {
	char buf[SIZE_OF_BUFFER];
	command->ToString(buf);

	byte execute_label[3] = { 0x0d, 0x0a, '>' };

	m_serial_port->write(reinterpret_cast<char *>(&execute_label[0]),
			sizeof(byte));
	m_serial_port->write(reinterpret_cast<char *>(&execute_label[1]),
			sizeof(byte));

	m_serial_port->write(buf, strlen(buf));

	m_serial_port->write(reinterpret_cast<char *>(&execute_label[0]),
			sizeof(byte));
	m_serial_port->write(reinterpret_cast<char *>(&execute_label[1]),
			sizeof(byte));
	m_serial_port->write(reinterpret_cast<char *>(&execute_label[2]),
			sizeof(byte));
}
}

